package com.mingshine.cloud.test;
 
 
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
 
/**
 * 消息发送到交换机确认机制
 * @Class MsgSendConfirmCallBack
 * @Author 作者姓名:LiuXing
 * @Version 1.0
 * @Date 创建时间：2019-05-20 17:07
 * @Direction 类说明
 */
public class MsgSendConfirmCallBack  implements RabbitTemplate.ConfirmCallback {
 
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        System.out.println("MsgSendConfirmCallBack  , 回调id:" + correlationData);
        if (ack) {
            System.out.println("消息消费成功");
        } else {
            System.out.println("消息消费失败:" + cause+"\n重新发送");
        }
    }
 
 
}